package unamed.main;

import basis.game.main.Core;
import basis.game.shape.Line2D;
import java.awt.Color;
import java.awt.Graphics2D;
import java.util.ArrayList;
import unamed.Art.Art;
import unamed.entities.Blast;
import unamed.entities.Blaster;
import unamed.entities.Lightning;

public class Unamed extends Core{
    
    public static void main(String[] args){
        Unamed n=new Unamed();
        n.init();
        n.loop();
    }
    
    private Blaster b;
    public static ArrayList<Blast> blasts;
    private int fire;
    private double angle;
    private Lightning li;
    
    @Override
    public void init(){
        Art.create();
        background=new Color(255,255,255);
        title="Unamed";
        width=600;
        height=400;
        FRAMELIMIT=60;
        super.init();
        b=new Blaster(100,100);
        blasts=new ArrayList<Blast>();
        li=new Lightning(new Line2D(100,100,200,30));
    }
    
    @Override
    public void update(long t){
        b.update(t);
        for(Blast bl:blasts){
            bl.update(t);
        }
        fire+=t;
        if(fire>=5000){
            fire=0;
            b.fire();
        }
        b.charge();
        angle+=.0025;
        b.setAngle(angle);
    }
    
    
    @Override
    public void render(Graphics2D g){
        super.render(g);
        g.setColor(Color.black);
        for(Blast bl:blasts){
            bl.render(g);
        }
        b.render(g);
        li.render(g);
        g.setColor(Color.GRAY);
        g.drawString("Fps:"+fps,20,40);
    }
    
}